package net.carmanagement;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;

public class ListarVeiculoActivity extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.listar_veiculos);

		DBHelper db = new DBHelper(this);

		Cursor cursor = db.getWritableDatabase().rawQuery(
				"select * from veiculo", null);

		startManagingCursor(cursor);

		ListAdapter adapter = new SimpleCursorAdapter(this,
				android.R.layout.simple_list_item_1, cursor,
				new String[] { "marca" }, new int[] { android.R.id.text1 });

		setListAdapter(adapter);
	}
}
